<template>
  <div class="head">
    <input type="text" autocomplete="off" v-model="fileName" placeholder="请输入标题" class="title"/>
    <div class="right">
      头像塞这里
    </div>
  </div>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { useStore } from '../store/index.js'
import {watch} from 'vue'
const store = useStore()
const { fileName } = storeToRefs(store)
watch(fileName, ()=>{
  document.title = fileName.value?fileName.value:'无标题'
}, {immediate: true})
</script>

<style lang="scss" scoped>
.head{
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  .title{
    font-size: 1.5em;
    font-weight: 900;
    width: 45em;
    text-align: center;
    border: none;
    outline: none;
  }
  .right{
    position: absolute;
    right: 0;
  }
}
</style>
